package cn.wh.mybatis.datasource.pooled;

import cn.wh.mybatis.datasource.unpooled.UnpooledDataSourceFactory;

import javax.sql.DataSource;

/**
 * @Description 有连接池的数据源连接工厂
 * @Version 1.0.0
 * @Date 2022/12/9 13:58
 * @Created wh
 */
public class PooledDataSourceFactory extends UnpooledDataSourceFactory {

    @Override
    public DataSource getDataSource() {
        PooledDataSource pooledDataSource=new PooledDataSource();
        pooledDataSource.setDriver(props.getProperty("driver"));
        pooledDataSource.setPassword(props.getProperty("password"));
        pooledDataSource.setUsername(props.getProperty("username"));
        pooledDataSource.setUrl(props.getProperty("url"));
        return pooledDataSource;
    }
}
